package com.shanks.framework.mq.demo.processor;

import com.alibaba.fastjson.JSON;
import com.shanks.framework.mq.domain.MQMessage;
import com.shanks.framework.mq.enums.MQStatusEnum;
import com.shanks.framework.mq.processor.AbstractMQProcessor;
import com.shanks.framework.mq.producer.BaseMQProducer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class DemoProcessor extends AbstractMQProcessor {

    public DemoProcessor(BaseMQProducer baseMQProducer){
        setMqProducer(baseMQProducer);
    }

    private static final Logger logger = LoggerFactory.getLogger(DemoProcessor.class);
    @Override
    protected MQStatusEnum consumeMessage(MQMessage message) throws Exception {
        logger.info("接收到消息为{}", JSON.toJSON(message));
        return MQStatusEnum.SUCCESS;
    }

    @Override
    protected String getMessageDesc(MQMessage message) {
        return "TEST";
    }
}
